<?php echo $header; ?>
<div class="content" style="margin-left: 10px; margin-right: 10px;">
    <div class="warning"<?php if(!$error_warning): ?> style="display:none"<?php endif; ?>><?php echo $error_warning; ?></div>
    <div class="success"<?php if(!$success): ?> style="display:none"<?php endif; ?>><?php echo $success; ?></div>

    <h3><?php echo $partial_payment;  ?></h3>
    <form action="<?php echo $action; ?>" method="post">
        <table class="list">
            <thead>
                <tr>
                    <td class="center"><?php echo $column_total; ?></td>
                    <td class="center"><?php echo $partial_payment; ?></td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td class="center total"><?php echo $order['total']; ?></td>
                    <td class="center"><input class="partial" type="text" name="order_partial[<?php echo $order['order_id']; ?>]" value="<?php echo $order['partial_paid']; ?>" /></td>
                </tr>
                <tr>
                    <td class="center" colspan="2"><a class="button" href="#" onclick=" return add_to_partial()"><?php echo $confirm; ?></a></td>
                </tr>
            </tbody>
        </table>
    </form>
</div>

<script type="text/javascript">

    function add_to_partial(){
        var url=$('form').attr('action');
        var data=$('form').serialize();

        $.ajax({
            url: url,
            type: 'get',
            data: data,
            dataType: 'json',
            success: function(json){
                if(json.error){
                    $('.warning').removeAttr('style');
                    $('.warning').html(json.error);
                }
                if(json.success){
                    $('.success').removeAttr('style');
                    $('.success').html(json.success);
                }
                if(json.result!="undefined"){
                    window.close();
                    window.opener.location.reload();
                }
            }
        });

        return false;
    }
</script>
<?php echo $footer; ?>
